package com.zimin.cloud.system.controller.api;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zimin.authorize.annotation.Authorize;
import com.zimin.cloud.mine.pojo.system.business.PostBO;
import com.zimin.cloud.system.pojo.entity.Post;
import com.zimin.shared.annotation.OpLog;
import com.zimin.shared.enums.ModuleEnum;
import com.zimin.shared.pojo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 岗位信息 前端控制器 接口
 * </p>
 *
 * @author zimin
 * @since 2021-12-30 11:05
 */
@RequestMapping("/sys/post")
@Api(value = "岗位信息API", tags = {"岗位信息API"})
public interface IPostController {


    /**
     * <p>查询岗位列表</p>
     *
     * @param postBO 查询参数
     * @return com.zimin.shared.pojo.Result
     * @since 2022-02-13 10:38:12
     */
    @GetMapping("/pageList")
    @Authorize(hasPerMi = "system:post:list")
    @OpLog(module = ModuleEnum.SYSTEM, action = "查询岗位列表")
    Result postPageList(Page<Post> postPage, PostBO postBO);

    /**
     * 获取所有的岗位
     */
    @GetMapping("/allPost")
    @Authorize(hasPerMi = "system:post:allPost")
    @OpLog(module = ModuleEnum.SYSTEM, action = "获取所有岗位")
    @ApiOperation(value = "获取所有岗位", notes = "获取所有岗位", httpMethod = "GET")
    Result allPost();

    /**
     * <p>保存岗位</p>
     *
     * @param postBO
     * @return com.zimin.shared.pojo.Result
     * @since 2022-02-14 15:55:52
     */
    @PostMapping
    @Authorize(hasPerMi = "system:post:save")
    @OpLog(module = ModuleEnum.SYSTEM, action = "保存岗位")
    @ApiOperation(value = "保存岗位", notes = "保存岗位", httpMethod = "POST")
    Result save(@RequestBody @Validated PostBO postBO);

    /**
     * <p>修改岗位</p>
     *
     * @param postBO 岗位对象
     * @return com.zimin.shared.pojo.Result
     * @since 2022-02-14 15:59:22
     */
    @PutMapping
    @Authorize(hasPerMi = "system:post:put")
    @OpLog(module = ModuleEnum.SYSTEM, action = "修改岗位")
    @ApiOperation(value = "修改岗位", notes = "修改岗位", httpMethod = "PUT")
    Result update(@RequestBody @Validated PostBO postBO);

    /**
     * 批量删除岗位
     */
    @DeleteMapping
    @Authorize(hasPerMi = "system:post:delete")
    @OpLog(module = ModuleEnum.SYSTEM, action = "批量删除岗位")
    @ApiOperation(value = "批量删除岗位", notes = "批量删除岗位", httpMethod = "DELETE")
    Result delete(@RequestParam(value = "idList") List<String> idList);

}
